<template>
  <router-view v-slot="{ Component }">
    <!--  可以做一个ifelse   把需要缓存的和不需要缓存的 分开 -->
    <component :is="Component" v-if="!route.meta.cache" />

    <keep-alive>
      <component :is="Component" v-if="route.meta.cache" />
    </keep-alive>
  </router-view>
</template>

<style scoped></style>
<script setup>
import { ref, watch } from "vue";
import { useRoute } from "vue-router";
let route = useRoute(); //  获取到当前的路由
</script>
